<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="../../common/operation_forbid.jsp" %>
<%@include file="../../common/jsVersion.jsp"%>
<c:set var="contextPath" value='${pageContext.request.contextPath}'/>
<!DOCTYPE html >
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>认筹</title>
    <!-- neptune -->
    <script type="text/javascript">
    var contextPath = '${contextPath}';
    </script>
    <%@include file="../../common/extInclude.jsp" %>
   
    <script type="text/javascript" src="${contextPath}/static/js/customer/payDeposit/view.js?v=${jsVersion}"></script>
    <script type="text/javascript" src="${contextPath}/static/js/components/processHistory.js?v=${jsVersion}"></script>
     <script type="text/javascript" src="${contextPath}/static/js/components/payDepositComponent.js?v=${jsVersion}"></script>
     <script type="text/javascript" src="${contextPath}/static/js/components/fileComponent.js?v=${jsVersion}"></script>
     <script type="text/javascript" src="${contextPath}/static/js/jquery/json2.js"></script> 
      <script type="text/javascript">
    
    var payDepositeId='${payDepositeId}';
    var procInstId = '${procInstId}';
    var documentType=${documentType};
    var processFlag='${processFlag}';
    var userName="${userName}";
    var menu= '${menu}';
    var returnUrl = '${returnUrl}';
    var roomStatus = '${roomStatus}';
    var shouStatus = '${shouStatus}';
    var auditStatus = '${auditStatus}';
    var isPaydeposit = '${isPaydeposit}';
    var returnBackParam= '${returnBackParam}';
    var businessStatus="${businessStatus}";
    var businessAbnormaId="${businessAbnormaId}";
    var projectId = null;
    
	var documentTypeStore = Ext.create('Ext.data.Store', {
	    fields: ['value', 'name'],
	    data :documentType
	});
	
	var gridStore = Ext.create('Ext.data.Store', {
		id:'familyMemberGridStore',
	    fields: ["memberName","documentType","documentNumber","mobile"],
	    //是否在服务端排序 （true的话，在客户端就不能排序）
	    remoteSort: false,
	    proxy: {
	        type: 'ajax',
	        url: contextPath+'/customer/familyMember/findList',
	        reader: {   //这里的reader为数据存储组织的地方，下面的配置是为json格式的数据，例如：[{"total":50,"rows":[{"a":"3","b":"4"}]}]
	            type: 'json', //返回数据类型为json格式
	            root: 'obj'
	        },
	        actionMethods: {read: 'POST'},
            extraParams:{
            	buyId:payDepositeId,
            	memberType:'2'
            }
	    },
	    autoLoad:true
	});
	
    // 收款、认购、签约、解除认筹 按钮控制
    	 var idata = '${permitBtn}';
	  	if(idata!=null||idata!=""){
			idata=JSON.parse(idata);
		}
	  	var marketingPayDepositReceivables = true; 
	  	var marketingSubscribeAdd = true;
	  	var marketingSignedAdd = true ;
	  	var marketingPayDepositRetreat= true ;
	  	var marketingPayDepositShou = true;
	  	var marketingPayDepositChangeName = true;
	  	
	  	var marketingPayDepositRetreatDtail = true;
	  	if(processFlag=="false"){
		  	if(Ext.Array.contains(idata,"marketing:payDeposit:receivables")){
	            //收款显示条件：审核通过且业务状态为(认筹|认筹转认购|认筹转签约|已更名)	
				if(auditStatus=="3" && (businessStatus=="1" || businessStatus=="2" || businessStatus=="3" || businessStatus=="4")){
					marketingPayDepositReceivables = false;
				}
		  	}
		  	if(Ext.Array.contains(idata,"marketing:subscribe:add")){
	            //认购显示条件：当有房认筹时：认筹审核通过且业务状态为(认筹|已更名)	且房间状态为认筹 当无房认筹时，审核通过且业务状态为(认筹|已更名)
	            if(isPaydeposit=="0"){
	            	if(auditStatus=="3" && (businessStatus=="1" || businessStatus=="4") && roomStatus=="3" ){
						marketingSubscribeAdd = false;
					}
	            }else if(isPaydeposit=="1"){
	            	if(auditStatus=="3" && (businessStatus=="1" || businessStatus=="4")){
	            		marketingSubscribeAdd = false;
	            	}
	            }
		  	}
		  	if(Ext.Array.contains(idata,"marketing:signed:add")){
	            //签约显示条件：当有房认筹时：认筹审核通过且业务状态为(认筹|已更名)	且房间状态为认筹 当无房认筹时，审核通过且业务状态为(认筹|已更名)
				if(isPaydeposit=="0"){
	            	if(auditStatus=="3" && (businessStatus=="1" || businessStatus=="4") && roomStatus=="3" ){
	            		marketingSignedAdd = false;
					}
	            }else if(isPaydeposit=="1"){
	            	//是无房认筹
	            	if(auditStatus=="3" && (businessStatus=="1" || businessStatus=="4")){
	            		marketingSignedAdd = false;
	            	}
	            }
		  	}
		  	if(Ext.Array.contains(idata,"marketing:payDeposit:retreat")){
	            //解除认筹显示条件
		  		if(auditStatus=="3" && (businessStatus=="1" || businessStatus=="4" )){
		  			marketingPayDepositRetreat = false;
				}
				
		  	}
		    //解除认筹显示条件
	  		if(auditStatus=="3" && businessStatus=="5"){
	  			marketingPayDepositRetreatDtail=false;
			}
		  	if(Ext.Array.contains(idata,"marketing:payDeposit:changeName")){
		  		//更名显示条件：审核通过且业务状态为(认筹|已更名)	
				if(auditStatus=="3" && (businessStatus=="1" || businessStatus=="4")){
		  			marketingPayDepositChangeName = false;
				}
		  	}
		  	if(Ext.Array.contains(idata,"marketing:payDeposit:receivablesDetail")){
		  		//收款明细
		 		if(auditStatus=="3" && shouStatus=="1"){
		 			marketingPayDepositShou = false;
				}else{
					marketingPayDepositShou = true;
				}
		  	}
	  	}
</script>
</head>
<script type="text/javascript">
Ext.onReady(function() {
	var viewPanel=Ext.create("customer.payDeposit.viewPanel");
	var estateRecord=${estateRecord};
	var customerRecord=${customerRecord};
	var payDepositeRecord=${payDepositeRecord};
	projectId = payDepositeRecord.projectId;
	console.log("projectId = " + projectId);
	//初始化值
	viewPanel.getComponent("estatePanel").getForm().setValues(estateRecord);
	if(estateRecord.paydepositName=="是"){
		viewPanel.getComponent("estatePanel").getComponent("isPaydepositTrue").hide();
	}else{
		viewPanel.getComponent("estatePanel").getComponent("isPaydepositTrue").show();
	}
	viewPanel.getComponent("customerPanel").getForm().setValues(customerRecord);
	viewPanel.getComponent("payDepositPanel").getForm().setValues(payDepositeRecord);
	
	
	//审核历史,展示当前审核状态
	var currAutidStatus = "";
	if(auditStatus == "0"){
		currAuditStatus = "<font style='color: red;'>待提交</font>";
	}else if(auditStatus == "1"){
		currAuditStatus = "<font style='color: red;'>审核中</font>";
	}else if(auditStatus == "2"){
		currAuditStatus = "<font style='color: red;'>已退回</font>";
	}else if(auditStatus == "3"){
		currAuditStatus = "<font style='color: red;'>已通过</font>";
	}
//  	Ext.getCmp("currAuditStatus").setValue(currAuditStatus);
 	
 	if(processFlag=="true" || processFlag==true){
 		Ext.getCmp("retrunBtn").setVisible(false);
 		//审批历史隐藏
 		Ext.getCmp("historyPanel").setVisible(false);
 	}
});
</script>
<body>
</body>
</html>